home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cujoct93.zip / 1110066A < prev    next >
Text File  |  1993-07-14  |  634b  |  24 lines

  1. // Input stream operator for SPString
  2. // allows the reading of long lines
  3. // and lines terminated by EOF and not '\n'
  4. istream& operator>>(istream& ifs, SPString& s)
  5. {
  6. char c, buf[132];
  7.   s= ""; // initialise with an empty string
  8.   // read a buffer from the input stream
  9.   ifs.get(buf, sizeof buf); 
  10.   if(ifs){ // if previous operation was ok
  11.     s += buf;     // append buffer to string
  12.     // if its a long line continue appending to string
  13.     while(ifs.good() && (c=ifs.get()) != '\n'){
  14.       ifs.putback(c);
  15.       // append to line
  16.       if(ifs.get(buf, sizeof buf)) s += buf;
  17.     }
  18.   }
  19.   return ifs;    
  20. }
  21.  
  22.  
  23.  
  24.